package achievements;

import java.io.*;

public class FileIO {

	public void fileOut(GameData data) {
		try {
			ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("Game.ser"));
			os.writeObject(data);
			os.close();
		} catch (IOException ex) {
			ex.printStackTrace();
		}

	}

	public GameData fileIn() {
		GameData data = null;
		try {
			ObjectInputStream is = new ObjectInputStream(new FileInputStream("Game.ser"));
			data = (GameData) (is.readObject());
			is.close();
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return data;

	}

}
